//
//  MCMMTCTableViewCell.m
//  TLYL
//
//  Created by miaocai on 2017/10/19.
//  Copyright © 2017年 TLYL01. All rights reserved.
//

#import "MCMMTCTableViewCell.h"
#import "MCTopUpRecrdTableViewCell.h"
#import "NSString+Helper.h"
#import "MCRecordTool.h"

@interface MCMMTCTableViewCell()

@property (weak, nonatomic)  UIView *bgView;
@property (weak, nonatomic)  UILabel *moneyLabel;
@property (weak, nonatomic)  UILabel *moneyDetailLabel;
@property (weak, nonatomic)  UILabel *dateLabel;
@property (weak, nonatomic)  UILabel *dateDetailLabel;
@property (weak, nonatomic)  UILabel *statusLabel;
@property (weak, nonatomic)  UIImageView *imgV;
@property (strong, nonatomic)  NSDictionary *dic;
@end

@implementation MCMMTCTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUpUI];
        self.backgroundColor = [UIColor colorWithHexString:@"#eff6fd"];
    }
    return self;
}

- (void)setUpUI{
    UIView *bgview = [[UIView alloc] init];
    [self.contentView addSubview:bgview];
    self.bgView = bgview;
    self.bgView.backgroundColor = [UIColor whiteColor];
    
    
    UILabel *statusLabel = [[UILabel alloc] init];
    [self.contentView addSubview:statusLabel];
    self.statusLabel = statusLabel;
    self.statusLabel.font = [UIFont systemFontOfSize:MC_REALVALUE(14)];
    self.statusLabel.textColor = [UIColor whiteColor];
    self.statusLabel.text = @"0";
    self.statusLabel.textAlignment = NSTextAlignmentCenter;
    
    UILabel *dateLabel = [[UILabel alloc] init];
    [self.contentView addSubview:dateLabel];
    self.dateLabel = dateLabel;
    self.dateLabel.text = @"时间";
    self.dateLabel.font = [UIFont systemFontOfSize:MC_REALVALUE(12)];
    self.dateLabel.textColor = RGB(136, 136, 136);
    
    UILabel *moneyLabel = [[UILabel alloc] init];
    [self.contentView addSubview:moneyLabel];
    self.moneyLabel = moneyLabel;
    self.moneyLabel.textAlignment = NSTextAlignmentCenter;
    self.moneyLabel.text = @"充值金额";
    self.moneyLabel.font = [UIFont systemFontOfSize:MC_REALVALUE(12)];
    self.moneyLabel.textColor = RGB(249, 84, 83);
    moneyLabel.numberOfLines = 0;
    
    
    UILabel *moneyDetailLabel = [[UILabel alloc] init];
    [self.contentView addSubview:moneyDetailLabel];
    self.moneyDetailLabel = moneyDetailLabel;
    self.moneyDetailLabel.font = [UIFont systemFontOfSize:MC_REALVALUE(12)];
    self.moneyDetailLabel.textColor = RGB(136, 136, 136);
    self.moneyDetailLabel.text = @"0";
    self.moneyDetailLabel.textAlignment = NSTextAlignmentCenter;
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];
    
    [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.equalTo(@(MC_REALVALUE(27)));
        make.top.equalTo(self).offset(MC_REALVALUE(20));
        make.left.equalTo(self).offset(MC_REALVALUE(22));
        
    }];
    self.statusLabel.layer.cornerRadius = MC_REALVALUE(13.5);
    self.statusLabel.clipsToBounds = YES;
    
    [self.dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.statusLabel);
        make.left.equalTo(self).offset(G_SCREENWIDTH * 0.25 - 5);
        make.width.equalTo(@(G_SCREENWIDTH * 0.25 - 6));
    }];
    
    [self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.statusLabel);
        make.left.equalTo(self).offset(G_SCREENWIDTH * 0.5 - 13);
        make.width.equalTo(@(G_SCREENWIDTH * 0.25 - 6));
    }];
    self.moneyDetailLabel.textAlignment = NSTextAlignmentLeft;
    self.moneyDetailLabel.numberOfLines = 0;
    [self.moneyDetailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.statusLabel);
        make.right.equalTo(self.mas_right).offset(0);
        make.width.equalTo(@(G_SCREENWIDTH * 0.25 - 6));
    }];
    
}



- (void)setDataSource:(MCTeamCModel *)dataSource{
    _dataSource = dataSource;
    MCUserARecordModel *Cmodel = [MCRecordTool getJiaoyiType:dataSource.DetailsSource and:dataSource.RechargeType andPayTypeName:dataSource.PayTypeName];
    self.statusLabel.backgroundColor = Cmodel.color;
    self.statusLabel.text = Cmodel.imgVName;
    self.dateLabel.text = dataSource.UserName;
    NSString *str =[NSString stringWithFormat:@"%@",dataSource.UseMoney];
    NSString *str1 =[NSString stringWithFormat:@"%@",dataSource.ThenBalance];
    self.moneyLabel.text = GetRealSNum(str);
    self.moneyDetailLabel.text = GetRealSNum(str1);
    
}


@end
